package com.zhuannimei.view;

import com.zhuannimei.GlobalApplication;
import com.zhuannimei.R;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class GrivatyToast {
	private static Toast toast = null;
	private static View view = null;
	private static TextView tv1 = null;

	public static void show(int icon, String msg, String msg1, Context context) {
		if (toast == null) {
			toast = new Toast(context);
			view = View.inflate(context, R.layout.custom_toast, null);
			tv1 = (TextView) view.findViewById(R.id.tv_toast_msg1);
		}
		tv1.setText(msg1);
		toast.setView(view);
		toast.setGravity(Gravity.CENTER, toast.getXOffset() / 10,
				toast.getYOffset() / 10);
		toast.setDuration(Toast.LENGTH_SHORT);
		toast.show();
	}

	public static void show(String msg1) {
		if (toast == null) {
			toast = new Toast(GlobalApplication.mContext);
			view = View.inflate(GlobalApplication.mContext,
					R.layout.custom_toast, null);
			tv1 = (TextView) view.findViewById(R.id.tv_toast_msg1);
		}
		tv1.setText(msg1);
		toast.setView(view);
		toast.setGravity(Gravity.CENTER, toast.getXOffset() / 10,
				toast.getYOffset() / 10);
		toast.setDuration(Toast.LENGTH_SHORT);
		toast.show();
	}
}
